import request from '@/utils/request'

// 查询主机信息列表
export function listHost(query) {
  return request({
    url: '/oms/host/',
    method: 'get',
    params: query
  })
}

// 查询主机信息详细
export function getHost(id) {
  return request({
    url: `/oms/host/${id}/`,
    method: 'get'
  })
}

// 查询主机详细历史
export function getHistory(id) {
  return request({
    url: `/oms/host/${id}/history/`,
    method: 'get',
  })
}

// 新增主机信息
export function addHost(data) {
  return request({
    url: '/oms/host/',
    method: 'post',
    data: data
  })
}

// 修改主机信息
export function updateHost(data) {
  return request({
    url: `/oms/host/${data.id}/`,
    method: 'put',
    data: data
  })
}

// 删除主机信息
export function delHost(id) {
  return request({
    url: `/oms/host/${id}/`,
    method: 'delete'
  })
}

// 释放占用主机
export function releaseHost(id) {
  return request({
    url: `/oms/host/${id}/release/`,
    method: 'get'
  })
}